feat: Archon wallet integration — Mage identity, Vault save/restore, Runecraft proof fields - #4
Open
Flaxscrip wants to merge 7 commits into
Open
feat: Archon wallet integration — Mage identity, Vault save/restore, Runecraft proof fields#4Flaxscrip wants to merge 7 commits into
Flaxscrip wants to merge 7 commits into
Conversation
…demo) Replace graph data with DID-blind Act-7 transmutation: 18 nodes, 21 edges. Fix stale localStorage edge crash (node-not-found guard before D3 forceLink). Add `poetic` field to SpellwebNode type for decomp node overlays. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- MageIdentityPanel: connect Archon wallet in-browser (encrypted StoredWallet)
- KeymasterContext: React context wrapping @didcid/keymaster for browser use
- mageIdentity: deriveMageKeyFromKeymaster() — sha256(secp256k1 sig) → Ed25519 seed
- mageHistory: MageArchonBackup — vault backup/restore via Archon Asset DID
- sessionPassphrase: secure in-memory passphrase handling for wallet unlock
- poh-cloak-contribution: Proof-of-Humanity cloak dataset contribution
- SpellWeb/Header: Archon wallet status + Mage ID display
- grimoire v10.1.0 update, node/edge additions
Mage identity is now portable: same did:cid wallet → same mage-{id} on any device.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…elds Add swordsmanId, runecrafted, and swordsmanSignature to SpellwebBladePayloadV1. Soulbis button now carries the full bilateral proof when the equipped blade has been Runecrafted, so agentprivacy.ai can display the binding status on arrival. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
KeymasterContext: add saveBladeToVault(itemName, content) and listVaultItems()
alongside the existing backupMageHistory. Both share the same lazily-created
vault (spellweb-mage-vault alias). Vault items use remove-then-add because
addVaultItem does not overwrite.
SpellWeb: on every forge, setPendingAutoBackup(newBlade) signals a useEffect
that fires after React commits the state update (so handleBackupToArchon sees
the full updated forgedBlades list). Two writes happen concurrently:
1. blade-{signature}.md — individual, human-readable blade file
2. mage-history.json — full snapshot (identity + blades + constellations)
generateBladeMd() extracts the markdown template from handleExportConstellation
into a standalone helper that works directly from a ForgedBlade object.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adds getVaultItem() to KeymasterContext and a ☁ ARCHON VAULT section to the Mage Spellbook modal. Wallet-connected users can browse all saved vault items (blade .md files + mage-history.json) and download any item with a single click. Safe Uint8Array copy avoids SharedArrayBuffer type issues across the Blob constructor boundary. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
13 tasks
- Serialize vault writes (saveBladeToVault → backupMageHistory) to prevent parallel addVaultItem calls stomping each other's DID document update - Add swordsmanLink to MageArchonBackup schema and both payload builders; restore path re-applies Swordsman link to localStorage on wallet unlock - Shorten save-game filename to stay under Archon's 32-char alias limit (mage-save-YYYY-MM-DDThh-mm-ss.json → save-YYYYMMDD-HHMMSS.json) - Optimistic vault browser update after save (avoids DID propagation lag) - Consolidate Backup + Save into single 💾 button - Surface getVaultItem null/error cases to console for debugging - Trigger vault save on Runecraft confirmation (not just initial forge) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All 9 poh-cloak-contribution nodes now have emoji fields. Added resolveNodeEmoji() helper that migrates saved '✦' placeholder emoji to the current node definition on localStorage init and backup restore. D3 canvas and constellation panel also fall back to node emoji at render time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR wires spellweb.ai into the Archon
did:cididentity layer, turning the Mage from a local-only persona into a cryptographically anchored identity backed by an Archon wallet. It introduces three capabilities:.mdfile to an encrypted Archon vault asset; full Mage history (spells, constellations, blades) is also backed up. A vault browser panel lets users list and download any saved item.SpellwebBladePayloadV1— the Soulbis button payload now carries bilateral proof data (swordsmanId,runecrafted,swordsmanSignature) so downstream apps (agentprivacy.ai) can display runecrafted status. A companion PR toagentprivacy-spellbookcovers the display side.Identity Architecture
Three distinct layers — not just Mage + Swordsman:
The Mage's keypair is derived from the
GenitriXDID using a deterministic HKDF path (spellweb-mage-v1). This means: same wallet → same Mage ID across any browser or device.Key Files Changed
src/contexts/KeymasterContext.tsxsrc/components/MageIdentityPanel.tsxsrc/lib/mageIdentity.tsderiveMageKeyFromKeymaster()derives stable Ed25519 keypair from Archon DIDsrc/lib/mageHistory.tsMageArchonBackupschema + vault alias constantssrc/utils/sessionPassphrase.tssrc/components/SpellWeb.tsxsrc/types/graph.tsSpellwebBladePayloadV1extended withswordsmanId?,runecrafted?,swordsmanSignature?src/data/nodes.ts/edges.tsVault Behaviour
spellweb-mage-vaultin the Archon wallet.mage-history.json(full state snapshot) +blade-<sig>.md(one per forged blade).removeVaultItem(swallow error if absent) →addVaultItem. This is consistent with Archon's append-only asset model.pendingAutoBackupstate +useEffectpattern to ensure React 18 batch commits the new blade to state before the backup fires. Avoids the stale-closure trap.mage-history.jsonis fetched from vault and applied to app state (spells, constellations, blades, edges, mana).Test Plan
Prerequisites
http://192.168.1.23:4224(or update gatekeeper URL in the wallet panel)npm run dev→ localhost:80001 — Wallet connect & Mage identity
mage-xxxxxxxxxxxxxxxx) appears in the identity panel2 — Blade auto-save to vault
[vault] blade savelog (no errors)blade-<sig>.mdandmage-history.jsonshould appear in the list.mddownloads with correct content3 — History restore
4 — Runecraft payload fields
spellwebBladequery param on agentprivacy.aiswordsmanId,runecrafted: true,swordsmanSignatureDependencies
@didcid/keymaster— wallet ops, vault, DID resolution@didcid/gatekeeper/drawbridge— gatekeeper client@didcid/cipher— encryption@didcid/keymaster/wallet/web— IndexedDB wallet storagebuffer— Node Buffer polyfill for browser vault encodingRequires a running Archon gatekeeper (local node or
https://archon.technology).What's NOT in this PR (coming next)
The Runecraft PR (companion, targeting
agentprivacy-spellbook) covers:⚔️🔮 runecraftedbadge display in BladeInventory and SpellwebBladeImport.mdon importSwordsmanAccountSettingsimport/replace flow🤖 Generated with Claude Code